package com.zygh.policeasset.mapper;

import com.zygh.policeasset.pojo.AdjustAssetsCard;
import com.zygh.policeasset.pojo.vo.AdjustAssetsCardVO;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/mapper/AdjustAssetsCardMapper.class */
public interface AdjustAssetsCardMapper {
    @Select({"select aac.id,aac.create_time,aac.reason,aac.assets_ids,aac.break_assets_ids,u.name as userName,d.dict_name from adjust_assets_card aac left join user u on aac.user_id = u.id left join dict_data d on aac.type = d.dict_value and d.dict_type='adjust_assets_card' order by aac.id desc"})
    @Results({@Result(property = "createTime", column = "create_time"), @Result(property = "assetsIds", column = "assets_ids"), @Result(property = "breakAssetsIds", column = "break_assets_ids"), @Result(property = "dictName", column = "dict_name")})
    List<AdjustAssetsCardVO> findAll();

    @Insert({"insert into adjust_assets_card (type,create_time,reason,assets_ids,break_assets_ids,user_id) values (#{type},#{createTime},#{reason},#{assetsIds},#{breakAssetsIds},#{userId})"})
    Integer add(AdjustAssetsCard adjustAssetsCard);

    @Update({"<script>update adjust_assets_card <set><if test='type != null '>type=#{type},</if><if test='createTime != null and createTime.length &gt; 0'>create_time=#{createTime},</if><if test='reason != null and reason.length &gt; 0'>reason=#{reason},</if><if test='assetsIds != null and assetsIds &gt;= 0'>assets_ids=#{assetsIds},</if><if test='breakAssetsIds != null and breakAssetsIds &gt;= 0'>break_assets_ids=#{breakAssetsIds},</if></set>where id=#{id}</script>"})
    Integer update(AdjustAssetsCard adjustAssetsCard);

    @Delete({"delete from adjust_assets_card where id=#{id}"})
    Integer delete(int i);
}